//
//  ChoseMenuViewController.m
//  ICrEAM
//
//  Created by mac on 16/11/18.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "ChoseMenuViewController.h"
#import "ParameterRespose.h"
#import "ICMCarePackageModel.h"
@interface ChoseMenuViewController ()
@property (weak, nonatomic) IBOutlet UITableView *choseTable;

@end

@implementation ChoseMenuViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.preferredContentSize =self.displaySize;
    [self.choseTable reloadData];
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  
    return self.choseArr.count;
    
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *cellID=@"menu";
    UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell==nil) {
        cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
 
        cell.selectionStyle=UITableViewCellSelectionStyleNone;
    }
    id model=self.choseArr[indexPath.row];
    if ([model isKindOfClass:[ParameterModel class]]) {
        ParameterModel *parameterModel=(ParameterModel*)model;
            cell.textLabel.text=parameterModel.desc;;
    }
    if ([model isKindOfClass:[ICMCarePackageThree_levelItemModel class]]) {
        ICMCarePackageThree_levelItemModel *parameterModel=(ICMCarePackageThree_levelItemModel*)model;
        cell.textLabel.text=parameterModel.OIL_NAME;;
    }

    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 44;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if ([self.delegate respondsToSelector:@selector(MenuDidClickIndex:)]) {
        [self.delegate MenuDidClickIndex:indexPath.row];
    }
    [self dismissViewControllerAnimated:YES completion:nil];
  
    
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
